asm
  ld sp,$87FF
  end asm

#include "./library/pacmandelay.bas"
#include "./library/smsrnd.bas"

dim eee as uinteger at $8010
dim seed as uinteger at $8012
dim ee0 as uinteger at $8014
dim ee1 as uinteger at $8016
dim ee2 as uinteger at $8018
dim ee3 as uinteger at $801A
dim eex as uinteger at $801C
dim eey as uinteger at $801E

seed=0


sub skylancerputchar(txp1 as uinteger,typ1 as uinteger,tch1 as ubyte):
  poke $8800+(typ1*64)+txp1,tch1
  end sub


sub skylancerpalette(tad2 as ubyte,tvl2 as uinteger,tbk2 as ubyte): '- only accessing from 0x00 to 0x54, i wonder why
  out $40+($10*tbk2),(tad2*3)
  out $41+($10*tbk2),((tvl2 band $F00)/$100)*$4
  out $40+($10*tbk2),(tad2*3)+1
  out $41+($10*tbk2),((tvl2 band $F0)/$10)*$4
  out $40+($10*tbk2),(tad2*3)+2
  out $41+($10*tbk2),(tvl2 band $F)*$4
  end sub

skylancerpalette(7,$CC7,1)
skylancerpalette(1,$C84,1)

skylancerpalette(0,$000,1)
skylancerpalette(1,$FFF,1)
skylancerpalette(2,$833,1)
skylancerpalette(3,$6BB,1)
skylancerpalette(4,$8B9,1)
skylancerpalette(5,$5A4,1)
skylancerpalette(6,$438,1)
skylancerpalette(7,$BC7,1)
skylancerpalette(8,$852,1)
skylancerpalette(9,$540,1)
skylancerpalette(10,$B66,1)
skylancerpalette(11,$555,1)
skylancerpalette(12,$777,1)
skylancerpalette(13,$9E8,1)
skylancerpalette(14,$76C,1)
skylancerpalette(15,$999,1)


for ee0=0 to 31
  for ee1=0 to 63
    seed=smsrnd(seed)
    skylancerputchar(ee1,ee0,seed band $F)
    next:next

for ee0=0 to 15
  for ee1=0 to 15
    skylancerputchar(ee1+47,ee0+15,ee0*16+ee1)
    next:next


eee=0
eex=8
eey=8

do

skylancerputchar(1,1,48+(int(eee/100) mod 10))
skylancerputchar(2,1,48+(int(eee/10) mod 10))
skylancerputchar(3,1,48+(eee mod 10))

ee0=in($00) bxor $FF
skylancerputchar(1,3,48+(int(ee0/100) mod 10))
skylancerputchar(2,3,48+(int(ee0/10) mod 10))
skylancerputchar(3,3,48+(ee0 mod 10))
eex=eex+(ee0 band 1) 'okddddcccc
eey=eey+((ee0 band 4)/4)

ee0=in($01) bxor $FF
skylancerputchar(1,4,48+(int(ee0/100) mod 10))
skylancerputchar(2,4,48+(int(ee0/10) mod 10))
skylancerputchar(3,4,48+(ee0 mod 10))
eex=eex-(ee0 band 1)
eey=eey-((ee0 band 4)/4)

ee0=in($02) bxor $FF
skylancerputchar(1,5,48+(int(ee0/100) mod 10))
skylancerputchar(2,5,48+(int(ee0/10) mod 10))
skylancerputchar(3,5,48+(ee0 mod 10))
ee0=in($03) bxor $FF
skylancerputchar(1,6,48+(int(ee0/100) mod 10))
skylancerputchar(2,6,48+(int(ee0/10) mod 10))
skylancerputchar(3,6,48+(ee0 mod 10))

ee0=in($10) bxor $FF
skylancerputchar(1,8,48+(int(ee0/100) mod 10))
skylancerputchar(2,8,48+(int(ee0/10) mod 10))
skylancerputchar(3,8,48+(ee0 mod 10))
ee0=in($11) bxor $FF
skylancerputchar(1,9,48+(int(ee0/100) mod 10))
skylancerputchar(2,9,48+(int(ee0/10) mod 10))
skylancerputchar(3,9,48+(ee0 mod 10))
ee0=in($12) bxor $FF
skylancerputchar(1,10,48+(int(ee0/100) mod 10))
skylancerputchar(2,10,48+(int(ee0/10) mod 10))
skylancerputchar(3,10,48+(ee0 mod 10))
ee0=in($13) bxor $FF
skylancerputchar(1,11,48+(int(ee0/100) mod 10))
skylancerputchar(2,11,48+(int(ee0/10) mod 10))
skylancerputchar(3,11,48+(ee0 mod 10))

skylancerputchar(eex,eey,eee band $7F)

eee=eee+1
pacmandelay(2000)
loop

do:loop
'-------------------------------------
do

'for eee=0 to 255
'  seed=smsrnd(seed)
'  out $41,eee
'  seed=smsrnd(seed)
'  out $40,eee
'  seed=smsrnd(seed)
'  out $51,eee
'  seed=smsrnd(seed)
'  out $50,eee
'  pacmandelay(1000)
'  next

'for eee=2 to 767 step 3
'  seed=smsrnd(seed)
'  'out $41,255
'  out $40,eee
'  seed=smsrnd(seed)
'  out $41,seed
'  seed=smsrnd(seed)
'  out $50,eee
'  seed=smsrnd(seed)
'  out $51,seed
'  pacmandelay(1000)
'  next


'for eee=$9800 to $97FF
'  seed=smsrnd(seed)
'  poke eee,seed
'  pacmandelay(1000)
'  next

for eee=$8800 to $8FFF
  seed=smsrnd(seed)
  poke eee,32+(seed mod 64)
  poke eee,seed
  poke eee,seed band 127
  pacmandelay(1000)
  next



loop

do

for eee=$8800 to $BFFF
  seed=smsrnd(seed)
  poke eee,seed
  'pacmandelay(1000)


  seed=smsrnd(seed)
  out $40,seed
  seed=smsrnd(seed)
  out $41,seed
  seed=smsrnd(seed)
  out $50,seed
  seed=smsrnd(seed)
  out $51,seed


  next

loop



'
'
'
'static ADDRESS_MAP_START( mem_map_skylncr, AS_PROGRAM, 8, skylncr_state )
' AM_RANGE(0x0000, 0x7fff) AM_ROM
' AM_RANGE(0x8000, 0x87ff) AM_RAM AM_SHARE("nvram")
'
' AM_RANGE(0x8800, 0x8fff) AM_RAM_WRITE(skylncr_videoram_w ) AM_SHARE("videoram")
' AM_RANGE(0x9000, 0x97ff) AM_RAM_WRITE(skylncr_colorram_w ) AM_SHARE("colorram")
'
' AM_RANGE(0x9800, 0x99ff) AM_RAM_WRITE(reeltiles_1_w ) AM_SHARE("reeltiles_1_ram")
' AM_RANGE(0x9a00, 0x9bff) AM_RAM_WRITE(reeltiles_2_w ) AM_SHARE("reeltiles_2_ram")
' AM_RANGE(0x9c00, 0x9dff) AM_RAM_WRITE(reeltiles_3_w ) AM_SHARE("reeltiles_3_ram")
' AM_RANGE(0x9e00, 0x9fff) AM_RAM_WRITE(reeltiles_4_w ) AM_SHARE("reeltiles_4_ram")
' AM_RANGE(0xa000, 0xa1ff) AM_RAM_WRITE(reeltileshigh_1_w ) AM_SHARE("rthigh_1_ram")
' AM_RANGE(0xa200, 0xa3ff) AM_RAM_WRITE(reeltileshigh_2_w ) AM_SHARE("rthigh_2_ram")
' AM_RANGE(0xa400, 0xa5ff) AM_RAM_WRITE(reeltileshigh_3_w ) AM_SHARE("rthigh_3_ram")
' AM_RANGE(0xa600, 0xa7ff) AM_RAM_WRITE(reeltileshigh_4_w ) AM_SHARE("rthigh_4_ram")
'
' AM_RANGE(0xaa55, 0xaa55) AM_READ(ret_ff )
'
' AM_RANGE(0xb000, 0xb03f) AM_RAM_WRITE(reelscroll1_w) AM_SHARE("reelscroll1")
' AM_RANGE(0xb040, 0xb07f) AM_RAM_WRITE(reelscroll1_w)
' AM_RANGE(0xb080, 0xb0bf) AM_RAM_WRITE(reelscroll1_w)
' AM_RANGE(0xb0c0, 0xb0ff) AM_RAM_WRITE(reelscroll1_w)
' AM_RANGE(0xb100, 0xb13f) AM_RAM_WRITE(reelscroll1_w)
' AM_RANGE(0xb140, 0xb17f) AM_RAM_WRITE(reelscroll1_w)
' AM_RANGE(0xb180, 0xb1bf) AM_RAM_WRITE(reelscroll1_w)
' AM_RANGE(0xb1c0, 0xb1ff) AM_RAM_WRITE(reelscroll1_w)
'
' AM_RANGE(0xb200, 0xb23f) AM_RAM_WRITE(reelscroll2_w) AM_SHARE("reelscroll2")
' AM_RANGE(0xb240, 0xb27f) AM_RAM_WRITE(reelscroll2_w)
' AM_RANGE(0xb280, 0xb2bf) AM_RAM_WRITE(reelscroll2_w)
' AM_RANGE(0xb2c0, 0xb2ff) AM_RAM_WRITE(reelscroll2_w)
' AM_RANGE(0xb300, 0xb33f) AM_RAM_WRITE(reelscroll2_w)
' AM_RANGE(0xb340, 0xb37f) AM_RAM_WRITE(reelscroll2_w)
' AM_RANGE(0xb380, 0xb3bf) AM_RAM_WRITE(reelscroll2_w)
' AM_RANGE(0xb3c0, 0xb3ff) AM_RAM_WRITE(reelscroll2_w)
'
' AM_RANGE(0xb400, 0xb43f) AM_RAM_WRITE(reelscroll3_w) AM_SHARE("reelscroll3")
' AM_RANGE(0xb440, 0xb47f) AM_RAM_WRITE(reelscroll3_w)
' AM_RANGE(0xb480, 0xb4bf) AM_RAM_WRITE(reelscroll3_w)
' AM_RANGE(0xb4c0, 0xb4ff) AM_RAM_WRITE(reelscroll3_w)
' AM_RANGE(0xb500, 0xb53f) AM_RAM_WRITE(reelscroll3_w)
' AM_RANGE(0xb540, 0xb57f) AM_RAM_WRITE(reelscroll3_w)
' AM_RANGE(0xb580, 0xb5bf) AM_RAM_WRITE(reelscroll3_w)
' AM_RANGE(0xb5c0, 0xb5ff) AM_RAM_WRITE(reelscroll3_w)
'
' AM_RANGE(0xb600, 0xb63f) AM_RAM_WRITE(reelscroll4_w) AM_SHARE("reelscroll4")
' AM_RANGE(0xb640, 0xb67f) AM_RAM_WRITE(reelscroll4_w)
' AM_RANGE(0xb680, 0xb6bf) AM_RAM_WRITE(reelscroll4_w)
' AM_RANGE(0xb6c0, 0xb6ff) AM_RAM_WRITE(reelscroll4_w)
' AM_RANGE(0xb700, 0xb73f) AM_RAM_WRITE(reelscroll4_w)
' AM_RANGE(0xb740, 0xb77f) AM_RAM_WRITE(reelscroll4_w)
' AM_RANGE(0xb780, 0xb7bf) AM_RAM_WRITE(reelscroll4_w)
' AM_RANGE(0xb7c0, 0xb7ff) AM_RAM_WRITE(reelscroll4_w)
'
' AM_RANGE(0xc000, 0xffff) AM_ROM
'ADDRESS_MAP_END
'
'
'static ADDRESS_MAP_START( io_map_skylncr, AS_IO, 8, skylncr_state )
' ADDRESS_MAP_GLOBAL_MASK(0xff)
'
' AM_RANGE(0x00, 0x03) AM_DEVREADWRITE("ppi8255_0", i8255_device, read, write)    /* Input Ports */
' AM_RANGE(0x10, 0x13) AM_DEVREADWRITE("ppi8255_1", i8255_device, read, write)    /* Input Ports */
'
' AM_RANGE(0x20, 0x20) AM_WRITE(skylncr_coin_w )
'
' AM_RANGE(0x30, 0x31) AM_DEVWRITE("aysnd", ay8910_device, address_data_w)
' AM_RANGE(0x31, 0x31) AM_DEVREAD("aysnd", ay8910_device, data_r)
'
' AM_RANGE(0x40, 0x41) AM_WRITE(skylncr_paletteram_w )
' AM_RANGE(0x50, 0x51) AM_WRITE(skylncr_paletteram2_w )
'
' AM_RANGE(0x70, 0x70) AM_WRITE(skylncr_nmi_enable_w )
'ADDRESS_MAP_END
'
'
'
'



'sub pingpongputsprite(tlayer as ubyte,tx as ubyte,ty as ubyte,tid as ubyte,tclut as ubyte):
'  poke $9006+((tlayer band 15)*4),tx  '- x sprite 0
'  poke $9004+((tlayer band 15)*4),ty bxor 255  '- y sprite 0
'  poke $9005+((tlayer band 15)*4),tid          '- shape sprite 0
'  poke $9003+((tlayer band 15)*4),tclut        '- clut? sprite 0
'  end sub
'
'function test1(t1 as uinteger,t2 as uinteger,t3 as uinteger,t4 as uinteger)  as uinteger
'  end function
'
'sub zpoke(t1 as uinteger,t2 as ubyte)
'  poke t1,t2
'  end sub
'
'sub putchar(tx1 as uinteger, ty1 as uinteger, tch1 as uinteger)
'  poke ($8400+(tx1*32)+ty1) bxor %0000001111100000,(tch1 band 255)
'  end sub
'
'


'
'
'
'pingpongputsprite(0,21,10,4,3)
'pingpongputsprite(1,21,30,4,3)
'pingpongputsprite(2,21,50,4,3)
'pingpongputsprite(3,21,70,4,3)
'pingpongputsprite(4,21,90,4,3)
'pingpongputsprite(5,21,110,4,3)
'pingpongputsprite(6,21,130,4,3)
'pingpongputsprite(7,21,150,4,3)
'
'seed=0
'
'for ee2=64 to 1023-64
'  for ee3=1 to 100
'    poke $8400+ee2,$01
'    next:next
'
'ee4=0
'for ee2=3 to 3+15
'  for ee3=15 to 15+15
'    poke $8400+ee3+(ee2*32),ee4
'    ee4=ee4+1
'    next:next
'
'ee4=0
'for ee2=20 to 20+7
'  for ee3=15 to 15+15
'    poke $8400+ee3+(ee2*32),ee4 band 3
'    poke $8000+ee3+(ee2*32),int(ee4/4)
'    ee4=ee4+1
'    next:next
'
'
'
'
'for ee2=4 to 7
'  for ee3=2 to 5
'    poke $8400+ee3+(ee2*32),code("X")
'    next
'    next
'
'test1(377,2445,63888,2342)
'
'eee=$4207
'i=code("Q")
'poke eee,i
'eee=eee+1
'i=code("T")
'poke eee,i
'
'seed=0
'for eee=$4400 to $47FF
'  seed=smsrnd(seed)
'  poke eee,seed
'  next
'
'ex0=80:ey0=176
'
'eee=0
'ecsp=0:ecsq=0
'
'
'do
'poke $A600,255 '- watchdog? - it seems to work! thanks, Jim Bagley!!!!
'
'ej0=peek($A800) bxor $ff
'ej1=peek($A880) bxor $ff
'
'poke ($8400+(10*32)+6) bxor %0000001111100000,ej0
'poke ($8400+(10*32)+7) bxor %0000001111100000,ej1
'
'poke ($8400+(12*32)+8) bxor %0000001111100000,48+(ex0 mod 10)
'poke ($8400+(12*32)+7) bxor %0000001111100000,48+((int(ex0/10)) mod 10)
'poke ($8400+(12*32)+6) bxor %0000001111100000,48+((int(ex0/100)) mod 10)
'
'poke ($8400+(13*32)+8) bxor %0000001111100000,48+(ey0 mod 10)
'poke ($8400+(13*32)+7) bxor %0000001111100000,48+((int(ey0/10)) mod 10)
'poke ($8400+(13*32)+6) bxor %0000001111100000,48+((int(ey0/100)) mod 10)
'
'poke ($8400+(14*32)+8) bxor %0000001111100000,48+(eee mod 10)
'poke ($8400+(14*32)+7) bxor %0000001111100000,48+((int(eee/10)) mod 10)
'poke ($8400+(14*32)+6) bxor %0000001111100000,48+((int(eee/100)) mod 10)
'poke ($8400+(14*32)+5) bxor %0000001111100000,48+((int(eee/1000)) mod 10)
'poke ($8400+(14*32)+4) bxor %0000001111100000,48+((int(eee/10000)) mod 10)
'
'poke ($8400+(15*32)+8) bxor %0000001111100000,48+(ej0 mod 10)
'poke ($8400+(15*32)+7) bxor %0000001111100000,48+((int(ej0/10)) mod 10)
'poke ($8400+(15*32)+6) bxor %0000001111100000,48+((int(ej0/100)) mod 10)
'
'poke ($8400+(16*32)+8) bxor %0000001111100000,48+(ej1 mod 10)
'poke ($8400+(16*32)+7) bxor %0000001111100000,48+((int(ej1/10)) mod 10)
'poke ($8400+(16*32)+6) bxor %0000001111100000,48+((int(ej1/100)) mod 10)
'
'poke ($8400+(17*32)+8) bxor %0000001111100000,48+(ecsp mod 10)
'
'if (ej1 band 64)<>0 then: ex0=ex0+1:end if
'if (ej1 band 32)<>0 then: ex0=ex0-1:end if
'if (ej1 band 4)<>0 then: ey0=ey0+1:end if
'if (ej1 band 2)<>0 then: ey0=ey0-1:end if
'
'if (ej1 band 15)<>0 then: ecsq=ecsq+1:end if
'ecsp=(int(ecsq/4))mod 8
'
'ee3=int(eee/4)
'
'pingpongputsprite( 0,ex0   ,ey0   ,4,3)  '- layer,x,y,id,clut
'pingpongputsprite( 1,ex0+16,ey0   ,4,3)  '- layer,x,y,id,clut
'pingpongputsprite( 2,ex0+32,ey0   ,4,3)  '- layer,x,y,id,clut
'pingpongputsprite( 3,ex0+48,ey0   ,4,3)  '- layer,x,y,id,clut
'pingpongputsprite( 4,ex0   ,ey0+16,4,3)  '- layer,x,y,id,clut
'pingpongputsprite( 5,ex0+16,ey0+16,4,3)  '- layer,x,y,id,clut
'pingpongputsprite( 6,ex0+32,ey0+16,4,3)  '- layer,x,y,id,clut
'pingpongputsprite( 7,ex0+48,ey0+16,4,3)  '- layer,x,y,id,clut
'pingpongputsprite( 8,ex0   ,ey0+32,4,3)  '- layer,x,y,id,clut
'pingpongputsprite( 9,ex0+16,ey0+32,4,3)  '- layer,x,y,id,clut
'pingpongputsprite(10,ex0+32,ey0+32,4,3)  '- layer,x,y,id,clut
'pingpongputsprite(11,ex0+48,ey0+32,4,3)  '- layer,x,y,id,clut
'pingpongputsprite(12,ex0   ,ey0+48,4,3)  '- layer,x,y,id,clut
'pingpongputsprite(13,ex0+16,ey0+48,4,3)  '- layer,x,y,id,clut
'pingpongputsprite(14,ex0+32,ey0+48,4,3)  '- layer,x,y,id,clut
'pingpongputsprite(15,ex0+48,ey0+48,4,3)  '- layer,x,y,id,clut
'
'
'eee=eee+1
'loop
'
''-------------------------------------------------------------------------------
'
'text01:
'asm
'  defb "HELLO WORLD!!!!!"
'  end asm
'
''-------------------------------------------------------------------------------
'
'
